Move effects
This article describes the kinds of in-battle move effects that exist in Pokémon Essentials. Move effect flags Some effects are given to a move by assigning one or more flags to that move. A flag is a letter, and a list of all flags and their effects can be found in the article Defining a move. The effects that are covered by flags are ignored when defining the function codes. For example, Slash has a high critical hit rate, but since there is a flag for that (h), its function code will be 000 as it has no other effect. Function codes : Main article: Function codes Most damaging moves, and all status moves, have an effect. This effect can range from simple ones like poisoning the foe, to complex and/or unique ones like Transform. To describe what a particular move does, it is assigned a function code. A function code describes a preset move effect (e.g. "moves with this function code may poison the foe"). Several moves can share the same function code. Each function code is a 3-digit hexadecimal number (e.g. 001, 02A, 0E3, 0DF, 12A). The various effects associated with a particular function code are (mostly) defined in the script section PokeBattle_MoveEffects, with each function code having its own class called PokeBattle_Move_XXX (where "XXX" is the function code). A function code's class typically contains all the information about that function code's effect. The contained methods can be any of the methods found in the class PokeBattle_Move (of which the function code's class is a sub-class), and can either replace or supplement them. The names of the methods are usually self-explanatory. Some function code classes are empty, but those function codes are still given to some moves (e.g. "0E9" for Endure). This is because some move effects are handled elsewhere, but they still depend on the move's function code. See below for more information. Every move needs to have a function code, even if the move has no special effect. The function code 000 is used for these moves. Function codes in other scripts Some move effects, or parts thereof, exist outside of the script section PokeBattle_MoveEffects. These effects are referred to by their function codes (because one function code is one effect), and the function code will appear in the form 0x02A, where the "0x" means "this is a hexadecimal number". Function codes which appear elsewhere include the ones for: * Curse, Endure, False Swipe, Jump Kick, Rage, Selfdestruct, Sky Uppercut, several others. These effects (or parts of effects) exist elsewhere because they cannot be made to fit into the function code's class as described above. Priority A move's priority is a number between -6 (lowest) and +6 (highest) which helps determine in which order moves should be used. A full description of what this number does can be found on the Internet, as it is a fundamental Pokémon mechanic. In Pokémon Essentials, a move's priority is defined separately from its effect. For example, Quick Attack has the function code 000 (no special effect) yet it has a priority of +1 (higher than normal). This is different to the official Pokémon games, which include the priority in the move's effect. Sound-based moves Some moves are sound-based, and thus Pokémon with the ability Soundproof are immune to them. The main bit of script relating to sound-based moves is in the script section PokeBattle_Battler in the def pbChangeTarget. In here it checks whether the move is a sound-based move (i.e. it has flag k), and if it is and it's used against a Pokémon with Soundproof, the move will fail with the message "Whismur's Soundproof blocks Growl!" (or similar). The above misses out the moves Heal Bell and Perish Song, as well as the lingering part of Uproar's effect. * Heal Bell is dealt with in its function code, because the message "A bell chimed!" should appear before it fails - this message would not appear if it were included in the list mentioned above. * Perish Song affects all Pokémon in battle, except those with Soundproof. It is also a lingering effect which shows up at several points in the scripts, and so it being sound-based needs to be considered at each of those points individually. * Uproar is included in the check mentioned above because its entire effect should fail if used against a Soundproof foe. However, if it is successfully used, then it has a lingering effect just like Perish Song. To find all points in the scripts where a move's sound-based nature is considered, simply search for the ability name "Soundproof". Lingering effects Lingering effects are ones which apply to the battle even after the move causing it has been used (even if it is just part of/a result of that move's effect). Such effects include Leech Seed, Reflect, weather-creating effects, Bide, Disable, Ingrain, toxic poisoning, and so forth. That is, they can perform a wide range of functions. A number of variables are defined at the start of a battle, either for each battler or for each side or for the whole field. They usually start in their "off" state. Using a move with a lingering effect will change the appropriate variable. Various things will depend on the values of these variables (e.g. if a battler's effectsPBEffects::Confusion value is greater than 0, then it is confused and should behave accordingly). A full list of these variables is available in the script section PBEffects. They are typically named after the move that has the lingering effect. Some lingering effects have multiple variables associated with them. For example, Bide has 3: one to state that it is being used, one which records the damage taken, and one which remembers the last Pokémon to attack it (which will be Bide's target). On the other hand, some variables are used by multiple moves. For example, the variable TwoTurnAttack is used by several different moves with several different function codes; no more than 1 of them can ever be used at once so they don't clash, and this particular part of the effect is the same for all of them. As mentioned earlier, some effects are battler-specific while some are side-specific, and some apply only to the whole field. All kinds are listed in the script section PBEffects. The side-specific and field-specific effects are defined (i.e. set to their "off" values) in the script section PokeBattle_ActiveSide, while the battler-specific effects are defined in the script section PokeBattle_Battler. All lingering effects will always be referred to in the form effectsPBEffects::Confusion, with the actual name of the effect being the only difference. This makes them easy to search for. Any further details about lingering effects are unnecessary and would be overly specific. You will likely not need to know even this much. If you are creating your own move effect with a lingering effect, this information shows how they are defined and how to find them; you can look at relevant examples yourself. Tips * If you are making a new move which is similar to an existing move, look at how the existing move works and copy it.